home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / CD CHIP.ISO / WebServ / server7 / bin / HTTPEXT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-03-27  |  4.6 KB  |  129 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi ISAPI Interface                          }
  5. {       Version 1.0 HTTP Server Extension interface.    }
  6. {                                                       }
  7. {       Copyright (c) 1996 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11.  
  12. unit HTTPExt;
  13.  
  14. interface
  15.  
  16. uses Windows;
  17.  
  18. const
  19.   HSE_VERSION_MAJOR         =   1;      // major version of this spec
  20.   HSE_VERSION_MINOR         =   0;      // minor version of this spec
  21.   HSE_LOG_BUFFER_LEN        =  80;
  22.   HSE_MAX_EXT_DLL_NAME_LEN  = 256;
  23.  
  24. type
  25.   HCONN = THandle;
  26.  
  27. // the following are the status codes returned by the Extension DLL
  28.  
  29. const
  30.   HSE_STATUS_SUCCESS                      = 1;
  31.   HSE_STATUS_SUCCESS_AND_KEEP_CONN        = 2;
  32.   HSE_STATUS_PENDING                      = 3;
  33.   HSE_STATUS_ERROR                        = 4;
  34.  
  35. // The following are the values to request services with the ServerSupportFunction.
  36. //  Values from 0 to 1000 are reserved for future versions of the interface
  37.  
  38.   HSE_REQ_BASE                             = 0;
  39.   HSE_REQ_SEND_URL_REDIRECT_RESP           = ( HSE_REQ_BASE + 1 );
  40.   HSE_REQ_SEND_URL                         = ( HSE_REQ_BASE + 2 );
  41.   HSE_REQ_SEND_RESPONSE_HEADER             = (HSE_REQ_BASE + 3 );
  42.   HSE_REQ_DONE_WITH_SESSION                = ( HSE_REQ_BASE + 4 );
  43.   HSE_REQ_END_RESERVED                     = 1000;
  44.  
  45. //
  46. //  These are Microsoft specific extensions
  47. //
  48.  
  49.   HSE_REQ_MAP_URL_TO_PATH                  = (HSE_REQ_END_RESERVED+1);
  50.   HSE_REQ_GET_SSPI_INFO                    = (HSE_REQ_END_RESERVED+2);
  51.  
  52.  
  53. //
  54. // passed to GetExtensionVersion
  55. //
  56.  
  57. type
  58.   PHSE_VERSION_INFO = ^THSE_VERSION_INFO;
  59.   THSE_VERSION_INFO = packed record
  60.     dwExtensionVersion: DWORD;
  61.     lpszExtensionDesc: array [0..HSE_MAX_EXT_DLL_NAME_LEN-1] of Char;
  62.   end;
  63.  
  64. type
  65.   TGetServerVariableProc = function ( hConn: HCONN;
  66.                                       VariableName: PChar;
  67.                       Buffer: Pointer;
  68.                                       var Size: DWORD ): BOOL stdcall;
  69.  
  70.   TWriteClientProc = function ( ConnID: HCONN;
  71.                                 Buffer: Pointer;
  72.                                 var Bytes: DWORD;
  73.                                 dwReserved: DWORD ): BOOL stdcall;
  74.  
  75.   TReadClientProc  = function ( ConnID: HCONN;
  76.                                 Buffer: Pointer;
  77.                                 var Size: DWORD ): BOOL stdcall;
  78.  
  79.   TServerSupportFunctionProc = function ( hConn: HCONN;
  80.                                           HSERRequest: DWORD;
  81.                                           Buffer: Pointer;
  82.                                           var Size: DWORD;
  83.                                           var DataType: DWORD ): BOOL stdcall;
  84.  
  85. //
  86. // passed to extension procedure on a new request
  87. //
  88. type
  89.  
  90.   PEXTENSION_CONTROL_BLOCK = ^TEXTENSION_CONTROL_BLOCK;
  91.   TEXTENSION_CONTROL_BLOCK = packed record
  92.     cbSize: DWORD;                    // size of this struct.
  93.     dwVersion: DWORD;                 // version info of this spec
  94.     ConnID: HCONN;                    // Context number not to be modified!
  95.     dwHttpStatusCode: DWORD;          // HTTP Status code
  96.              // null terminated log info specific to this Extension DLL
  97.     lpszLogData: array [0..HSE_LOG_BUFFER_LEN-1] of Char;
  98.     lpszMethod: PChar;                // REQUEST_METHOD
  99.     lpszQueryString: PChar;           // QUERY_STRING
  100.     lpszPathInfo: PChar;              // PATH_INFO
  101.     lpszPathTranslated: PChar;        // PATH_TRANSLATED
  102.     cbTotalBytes: DWORD;              // Total bytes indicated from client
  103.     cbAvailable: DWORD;               // Available number of bytes
  104.     lpbData: Pointer;                 // pointer to cbAvailable bytes
  105.     lpszContentType: PChar;           // Content type of client data
  106.  
  107.     GetServerVariable: TGetServerVariableProc;
  108.     WriteClient: TWriteClientProc;
  109.     ReadClient: TReadClientProc;
  110.     ServerSupportFunction: TServerSupportFunctionProc;
  111.   end;
  112.  
  113. //
  114. //  these are the prototypes that must be exported from the extension DLL
  115. //
  116.  
  117. //  function GetExtensionVersion( var Ver: THSE_VERSION_INFO ): BOOL; stdcall;
  118. //  function HttpExtensionProc( var ECB: TEXTENSION_CONTROL_BLOCK ): DWORD; stdcall;
  119.  
  120. // the following type declarations is for the server side
  121.  
  122. // typedef BOOL  (WINAPI * PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO  *pVer );
  123. // typedef DWORD (WINAPI * PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB );
  124.  
  125. implementation
  126.  
  127. end.
  128. 
  129.